#Temperature Calculation module
#2022年11月21日 N.SUN
#coding: utf-8
import os
#関数定義
def getdata():
x = float(input("温度を入力してください:"))
return x
def choose():
while True:
choice = input("C -> F: 1, F -> C: 2 >>> ")
if choice not in ['1', '2']:
print("入力ミス。もう一度入力してください。")
elif choice in ['1','2']:
break
return int(choice)-1
def calCF():
word = ["C -> F","F -> C","Celsius","Fahrenheit"]
choice = choose()
print("あなたは"+word[choice]+"しますので、"+word[choice+2]+"の",end='')
if choice == 0:
Celsius = getdata()
Fahrenheit = round((Celsius * 1.8) + 32, 2)
print(str(Celsius) + " degree Celsius is " + str(Fahrenheit) + " degree Fahrenheit.")
elif choice == 1:
Fahrenheit = getdata()
Celsius = round((Fahrenheit - 32) / 1.8, 2)
print(str(Fahrenheit) + " degree Fahrenheit is " + str(Celsius) + " degree Celsius.")